package com.wgu.crawl.service.impl;

import com.wgu.crawl.CrawlBook;
import com.wgu.crawl.repo.CrawlBookRepository;
import com.wgu.crawl.service.CrawlBookService;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;

/**
 * @Author: w
 * @Date: 2019/6/27 14:28
 * @Version 1.0
 */
@Service
public class CrawlBookServiceImpl implements CrawlBookService {
    @Resource
    private CrawlBookRepository crawlBookRepository;

    @Override
    @Transactional
    public CrawlBook save(CrawlBook crawlBook) {
        return crawlBookRepository.save(crawlBook);
    }

    @Override
    public List<CrawlBook> page(Pageable pageable) {
        return crawlBookRepository.findAll(pageable).getContent();
    }
}
